//! @author Adam Emil Skoog
//! @date   2012-01-05

#ifndef MEHDI_BODY_H_
	#define MEHDI_BODY_H_
	#include "Drawable.h"
	#include "CollisionMask.h"
	#include <vector>

	namespace mehdi
	 {
		class Body : public Drawable
		 {
			public:
				Body();
				Body &setHorizontalSpeed(const float &);
				const float &getHorizontalSpeed() const;
				Body &setVerticalSpeed(const float &);
				const float &getVerticalSpeed() const;
				Body &setReceptiveToGravity(const bool &set = true);
				const bool &isReceptiveToGravity() const;
				Body &setReceptiveToCollision(const bool &set = true);
				const bool &isReceptiveToCollision() const;
				CollisionMask *const createCollisionMask();
				bool destroyCollisionMask(CollisionMask *const);
				bool destroyCollisionMaskAt(const unsigned &);
				const std::vector<CollisionMask *> &getCollisionMasks() const;
				~Body();

			protected:
				virtual void onCollision(Body *const) {}
				virtual void onLand() {}

			private:
				float  horizontalSpeed,
					   verticalSpeed;
				double fallTime;
				bool   inAir,
					   gravitation,
					   collision;

				std::vector<CollisionMask *> masks;

				void updatePhysics();
				void land(Body *const);

			friend class Level;
		 };
	 }
#endif
